TAG=index.mindcoder.cn/docker/centos/face_recognition:latest
CONTAINER=mindcoder-face_recognition-centos
VOLUMES=-v /mnt:/mnt
PORTS=-p 5001:5001
DAEMONFLG=-it
RESTART=--restart=always

all: clean build run

build:
	docker build -t $(TAG) . --no-cache

run:
	@docker run $(DAEMONFLG) $(RESTART) --name $(CONTAINER) $(VOLUMES) $(PORTS) $(TAG); \
	echo "Run finished"

start:
	docker start $(DAEMONFLG) $(CONTAINER)

stop:
	docker stop $(CONTAINER)

restart:
	docker restart $(CONTAINER)

shell:
	docker exec -it $(CONTAINER) /bin/bash

clean:
	@docker kill $(CONTAINER) 2> /dev/null; \
	docker rm $(CONTAINER) 2> /dev/null; \
	docker rmi $(TAG) 2> /dev/null; \
	echo "Clean OK"

